package com.zzl.bonds.ticket.dto.finance;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.zzl.apidoc.annotation.ApidocModel;
import com.zzl.apidoc.annotation.ApidocModelProperty;
import com.zzl.bonds.ticket.constant.status.CreditStatusEnum;
import com.zzl.bonds.ticket.dto.KeyValue;
import com.zzl.general.common.utils.DoubleSerialize;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 供应商融资授信额度
 *
 * @author gull
 * @date 2022-02-16 14:04:04
 */
@Data
@ApidocModel
@SuppressWarnings("javadoc")
public class SupplierCreditListDto implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApidocModelProperty(description = "主键")
    private String id;
    @ApidocModelProperty(description = "额度编号")
    private String creditNo;

    @ApidocModelProperty(description = "金融机构id")
    private Integer financeInstitutyId;

    @ApidocModelProperty(description = "额度授信主体")
    private String receiveEnterpriseName;
    @ApidocModelProperty(description = "金融机构")
    private String financeInstitutyName;
    @JsonSerialize(using = DoubleSerialize.class)
    @ApidocModelProperty(description = "额度总额")
    private Double creditAllAmount;
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApidocModelProperty(description = "失效日期", validate = "yyyy-MM-dd")
    private Date effectTime;
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApidocModelProperty(description = "失效日期", validate = "yyyy-MM-dd")
    private Date expireTime;

    @ApidocModelProperty(description = "授信状态  1未生效 2生效 3已失效 4冻结")
    private String creditStatusStr;
    @JsonIgnore
    private Integer creditStatus;
    @ApidocModelProperty(description = "操作按钮集合")
    private List<KeyValue> operateButton;

    public String getCreditStatusStr() {
        return CreditStatusEnum.getStatusName(creditStatus);
    }

}
